define([
    'app',
], function (app) {
    'use strict';
    app.controller('jianjiaoCtrl', ['$scope', '$state', '$location', function($scope, $state, $location){
        var thirdpartyOrderId = $location.search().order_id || 'null';
        var redirectUri = $location.search().redirect_uri || 'm.malianghang.com';
        var thirdpartyId = $location.search().thirdparty_id || 'jianjiao';
        $scope.toProduct = function(name, type){
	        var params = {
	        	name: name,
                order_id: thirdpartyOrderId,
                redirect_uri: redirectUri,
                thirdparty_id: thirdpartyId
	        }
	        if(type) params.type = type;
	        console.log(type);
	        $state.go('product', params);
        }
    }]);
});
